home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / txtsvc / nsISpellChecker.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  6KB  |  152 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #ifndef nsISpellChecker_h__
  39. #define nsISpellChecker_h__
  40.  
  41. #include "nsISupports.h"
  42.  
  43. #define NS_SPELLCHECKER_CONTRACTID "@mozilla.org/spellchecker;1"
  44.  
  45. #define NS_ISPELLCHECKER_IID                    \
  46. { /* E75AC48C-E948-452E-8DB3-30FEE29FE3D2 */    \
  47. 0xe75ac48c, 0xe948, 0x452e, \
  48.   { 0x8d, 0xb3, 0x30, 0xfe, 0xe2, 0x9f, 0xe3, 0xd2 } }
  49.  
  50. class nsITextServicesDocument;
  51. class nsString;
  52. class nsStringArray;
  53.  
  54. /**
  55.  * A generic interface for a spelling checker.
  56.  */
  57. class nsISpellChecker  : public nsISupports{
  58. public:
  59.  
  60.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISPELLCHECKER_IID)
  61.  
  62.   /**
  63.    * Tells the spellchecker what document to check.
  64.    * @param aDoc is the document to check.
  65.    * @param aFromStartOfDoc If true, start check from beginning of document,
  66.    * if false, start check from current cursor position.
  67.    */
  68.   NS_IMETHOD SetDocument(nsITextServicesDocument *aDoc, PRBool aFromStartofDoc) = 0;
  69.  
  70.   /**
  71.    * Selects (hilites) the next misspelled word in the document.
  72.    * @param aWord will contain the misspelled word.
  73.    * @param aSuggestions is an array of nsStrings, that represent the
  74.    * suggested replacements for the misspelled word.
  75.    */
  76.   NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsStringArray *aSuggestions) = 0;
  77.  
  78.   /**
  79.    * Checks if a word is misspelled. No document is required to use this method.
  80.    * @param aWord is the word to check.
  81.    * @param aIsMisspelled will be set to true if the word is misspelled.
  82.    * @param aSuggestions is an array of nsStrings which represent the
  83.    * suggested replacements for the misspelled word. The array will be empty
  84.    * if there aren't any suggestions.
  85.    */
  86.   NS_IMETHOD CheckWord(const nsAString &aWord, PRBool *aIsMisspelled, nsStringArray *aSuggestions) = 0;
  87.  
  88.   /**
  89.    * Replaces the old word with the specified new word.
  90.    * @param aOldWord is the word to be replaced.
  91.    * @param aNewWord is the word that is to replace old word.
  92.    * @param aAllOccurrences will replace all occurrences of old
  93.    * word, in the document, with new word when it is true. If
  94.    * false, it will replace the 1st occurrence only!
  95.    */
  96.   NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, PRBool aAllOccurrences) = 0;
  97.  
  98.   /**
  99.    * Ignores all occurrences of the specified word in the document.
  100.    * @param aWord is the word to ignore.
  101.    */
  102.   NS_IMETHOD IgnoreAll(const nsAString &aWord) = 0;
  103.  
  104.   /**
  105.    * Add a word to the user's personal dictionary.
  106.    * @param aWord is the word to add.
  107.    */
  108.   NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord) = 0;
  109.  
  110.   /**
  111.    * Remove a word from the user's personal dictionary.
  112.    * @param aWord is the word to remove.
  113.    */
  114.   NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord) = 0;
  115.  
  116.   /**
  117.    * Returns the list of words in the user's personal dictionary.
  118.    * @param aWordList is an array of nsStrings that represent the
  119.    * list of words in the user's personal dictionary.
  120.    */
  121.   NS_IMETHOD GetPersonalDictionary(nsStringArray *aWordList) = 0;
  122.  
  123.   /**
  124.    * Returns the list of strings representing the dictionaries
  125.    * the spellchecker supports. It was suggested that the strings
  126.    * returned be in the RFC 1766 format. This format looks something
  127.    * like <ISO 639 language code>-<ISO 3166 country code>.
  128.    * For example: en-US
  129.    * @param aDictionaryList is an array of nsStrings that represent the
  130.    * dictionaries supported by the spellchecker.
  131.    */
  132.   NS_IMETHOD GetDictionaryList(nsStringArray *aDictionaryList) = 0;
  133.  
  134.   /**
  135.    * Returns a string representing the current dictionary.
  136.    * @param aDictionary will contain the name of the dictionary.
  137.    * This name is the same string that is in the list returned
  138.    * by GetDictionaryList().
  139.    */
  140.   NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary) = 0;
  141.  
  142.   /**
  143.    * Tells the spellchecker to use a specific dictionary.
  144.    * @param aDictionary a string that is in the list returned
  145.    * by GetDictionaryList().
  146.    */
  147.   NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary) = 0;
  148. };
  149.  
  150. #endif // nsISpellChecker_h__
  151.  
  152.